<template>
	<view class="me">
		<my-header bgColor="bg-gradual-blue" :isBack="false">
			<block slot="backText">返回</block>
			<block slot="content">个人中心</block>
		</my-header>
        <view class="user_info row">
            <image class="avatar" :src="user.avatarUrl" mode="" />
            <view class="info">
                <view class="name">{{user.nickName}}</view>
				<vieew class="sex row">
					性别：
					<view v-if="user.gender==1" class="cuIcon-male  man"></view>
					<!-- <view v-if="user.gender==1" class="cuIcon-female woman"></view> -->
					<view v-if="user.gender==2" class="cuIcon-female woman"></view>
				</vieew>
            </view>
        </view>
		<view class="list">
			<view class="item row" v-for="(item,index) in list" :key="index" @click="go(item)">
				<image class="icon" :src="item.icon"/>
				{{item.name}}
				<view class="cuIcon-right right"></view>
			</view>
		</view>
			
		<my-footer cur="1"></my-footer>

	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				user:{},
				list:[
					{
                    // "icon"=>$url."zhifu-yue.png",
						icon:"/static/icon/link.png",
						name:"复制链接",
						type:"copy",
						link:"http://localhost:8080/"
					},
					// #ifndef MP-WEIXIN
					{
						icon:"/static/icon/tag.png",
						name:"标签管理",
						link:"/admin/house/tag"
					},
					{
						icon:"/static/icon/house.png",
						name:"房源管理",
						link:"/admin/house/house"
					},
					// #endif

					{
						icon:"/static/icon/about.png",
						name:"关于我们",
						link:"/tools/about/index?module=house"
					},
				]
			}
		}, 
		created(){
			this.initData()
			this.get_userInfo()
		},
		methods: {
			async initData(){
				const res=await uni.$request({
				},"api/applet/visit_info")
				// this.content=res
            },
            async get_userInfo(){
				const res=await uni.$request({
                },"api/user/get_userInfo")
                this.user=res.data
			},
			go(item){
				if (item.type=="copy") {
					let openid= uni.getStorageSync('openid')
					uni.$copy(item.link+"?"+openid)
				}else{
					

					uni.navigateTo({
						url:item.link,
						success:(res)=>{
							console.log(res);
						},
						fail:(err)=>{
							console.log(err);
						}
					});
				}
				
			},
			
			
		}
	}
</script>

<style lang="scss">
	@import "./index";
</style>